<template>
	<view class="wrap">
		<!--	<u-swiper :height="270" :list="imgList" :title="false" @click="imgListClick"></u-swiper>-->
		<scroll-view class="scroll-list msg-list-item" scroll-y="true">
			<uni-card v-for="(item, index) in noticeList" :key="index" @click="navTo(item)">
				<uni-view class="uni-media-list">
					<uni-view
						:class="{ 'uni-card-read': item.sysUserNotice.isRead === 1, 'uni-card-unread': item.sysUserNotice.isRead === 0 }">
						<uni-view class="uni-media-list-text-top"><span>{{item.noticeTitle}}</span></uni-view>
						<br>
						<uni-view class="uni-media-list-text-bottom">
							<uni-text><span>{{item.createBy}}</span><span
									style="font-size: 26rpx;color: #999999;padding-left: 10px;">{{item.createTime}}</span></uni-text>
						</uni-view>
					</uni-view>
				</uni-view>
			</uni-card>
			<u-divider>已经到底了</u-divider>
		</scroll-view>
	</view>
</template>
<script>
	import store from '@/store/index.js';
	import {
		getNoticeList
	} from '@/api/system/user.js';
	export default {
		data() {
			return {
				noticeList: [],
				total: 0,
			};
		},
		onShow() {
			this.getNoticeListInfo();
		},
		methods: {
			getNoticeListInfo() {
				getNoticeList("1", "10000").then(res => {
					this.noticeList = res.rows;
					// this.total = res.total;
					var count = 0;
					// this.total = res.total;
					res.rows.map(item => {
						if (this.$store.getters.userId != 1) {
							if (item.sysUserNotice.isRead == 0) {
								count++;
							}
						}
					})
					this.total = count;
					uni.$emit('total', this.total);
				})
			},
			navTo(item) {
				console.log(item.id)
				this.$tab.navigateTo('/pages/work/worknotice/detail');
				store.state.CusImform = item;
				console.log('store.state.CusImform:', store.state.CusImform);
			},
		},
	}
</script>
</script>
<style lang="scss">
	page {
		background-color: #f5f5f5;
	}

	.wrap .search {
		background: #ffffff;
	}

	.msg-time {
		font-size: 26rpx;
		padding: 10px 0;
		color: #999999;
		text-align: center;
	}

	.u-card__foot {
		.u-icon {
			margin-right: 10px;
		}
	}

	.u-swiper-wrap {
		padding: 0 10px;
	}

	.uni-media-list {
		// padding: 10px 10px;

	}

	.uni-media-list-body {

		height: 40px;
		// padding-left: 20rpx;
		padding-top: 10rpx;
	}

	.uni-card-read {
		color: #999999;
	}

	.uni-card-unread {
		color: #6a6a6a;
	}
</style>